﻿<!--#include virtual="/Common/Config.asp" -->
<!--#include virtual="/Common/conn.asp" -->
<!--#include virtual="/2010admin/Check_IsLogin.asp" -->
<!--#include virtual="/Common/Function.asp" -->
<!--#include file="Role_Inc.asp" -->
<!--#include virtual="/2010admin/Check_Priv.asp"-->

<%
Dim useranme,password,Super,Lock

If Request.ServerVariables ("Request_Method")="POST" Then

	'禁止从网站外部提交数据
	Call Deny_OutSiteSubit()

	Call Role_Edit()	
Else

	RoleID = requery("RoleID")


	Call Get_Role_Info(RoleID)
	
	MenuID_Array = Get_MenuIDArray(RoleID)

End If


%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="/2010admin/css/default.css" type="text/css" rel="stylesheet">
<title><%=web_title%></title>
<script language="javascript" src="/js/main.js"></script>
<script language="javascript" src="/js/selects.js"></script>
<script language="javascript" src="/js/manage.js"></script>
<script language="javascript" src="/2010admin/js/validator.js"></script>
</head>
<script language="javascript">
function checkall()
{
	  field = document.form.MenuID;
	  if (field.length)
	  {
		slength = field.length;
		for (var i = 0; i < slength; i++) { field[i].checked = true; }
	  }
	  else { field.checked = true; }

}
function uncheck(field)
{
	  field = document.form.MenuID;
	  if (field.length)
	  {
		slength = field.length;
		for (var i = 0; i < slength; i++) {
		field[i].checked = !field[i].checked;
		}
	  }
	  else { field.checked = !field.checked; }

}

</script>
<script type="text/javascript">
function CG_popedom(strers)
{
  if (strers == "0") get_id("tr_popedom").style.display = '';
  else get_id("tr_popedom").style.display = 'none';
}
</script>
<table border="0" width="100%" cellSpacing="0" cellPadding="0">
  <tr>
    <td width="100%" height="5"></td>
  </tr>
  <tr>
    <td width="100%" align="center">
      <table border="0" width="98%" cellSpacing="0" cellPadding="0">
        <tr>
          <td width="*" align="center" valign="top">
            <table border="0" width="100%" cellSpacing="0" cellPadding="0" class="lrbtline">
              <tr>
                <td width="100%" height="25" class="tbtop">管理导航</td>
              </tr>
              <tr>
                <td width="100%" align="center">
                  <table border="0" width="98%" cellSpacing="0" cellPadding="0">
                    <tr>
                      <td width="100%" height="5"></td>
                    </tr>
                  </table>
                  <table border="0" width="98%" cellSpacing="0" cellPadding="0">
                    <tr>
                      <td width="100%" height="20">&nbsp;<img src="/2010admin/images/sico.gif" border="0">&nbsp;<span id="userlist"><a href="Role_Query.asp">角色列表</a></span>&nbsp;<img src="/2010admin/images/sico.gif" border="0">&nbsp;<span id="useradd"><a href="Role_Add.asp">增加新的角色</a></span></td>
                    </tr>
                    <tr>
                      <td width="100%" height="5"></td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
            <table border="0" width="100%" cellSpacing="0" cellPadding="0">
              <tr>
                <td width="100%" height="5"></td>
              </tr>
            </table>
            <table border="0" width="100%" cellSpacing="0" cellPadding="0" class="lrbtline">
              <tr>
                <td width="100%" height="25" class="tbtop">编辑角色</td>
              </tr>
              <tr>
                <td width="100%" align="center">
                  <table border="0" width="98%" cellSpacing="0" cellPadding="0">
                    <tr>
                      <td width="100%" height="5"></td>
                    </tr>
                  </table>
                  <table border="0" width="98%" cellSpacing="0" cellPadding="0">
                  <form name="form" method="post" action="" onSubmit="return Validator.Validate(this, 2)">
                    <tr>
                      <td width="80" height="25">角色名称</td>
                      <td width="*"><input type="text" name="RoleName" value="<%=RoleName%>" size="20" dtype="Limit" min="2" max="50" dmsg="角色名称必须在2-50个字符间"></td>
                    </tr>
					<tr id="tr_popedom" style="DISPLAY: block">
					  <td valign="top">权限</td>
					  <td>
					 <%	sql = " SELECT MenuID,MenuName FROM Admin_Menu  WHERE ParentID=0 "

						Set rs = conn.execute(sql)

						If rs.Eof Then
							Response.write "&nbsp;"
						Else

						
						%>
					  <table width="100%"  border="0" cellspacing="0" cellpadding="0">
					  <% Do While Not rs.Eof  %>
                        <tr>
                          <td colspan="2"><input type="checkbox"" class="radio" name="MenuID" value="<% =rs(0) %>" <%=Get_MenuIDChecked(rs(0),MenuID_Array)%>> <%=rs(1)%></td>
                        </tr>
						<%
						sql2 = " SELECT MenuID,MenuName,MenuPath FROM  Admin_Menu WHERE ParentID= "&rs(0)
						Set rs2 = conn.execute(sql2)
						If Not rs2.Eof Then
						%>
                        <tr>
                          <td width="2%">&nbsp;</td>
                          <td width="98%">
						  <%

						    j = 1

							Do While Not rs2.Eof 

								Response.write "<input type=""checkbox"" class=""radio"" name=""MenuID"" value=" & rs2(0) & " "&Get_MenuIDChecked(rs2(0),MenuID_Array)&"><font class=""ash"">"& rs2(1) &"</font>&nbsp;"

								If j Mod 5=0 Then Response.write "<br />"

								j = j+1

								rs2.movenext
							Loop
						   %>
						  </td>
                        </tr>
						<%
						End If
						rs2.close
					  rs.Movenext
					  Loop
					  End If
					  rs.close

					  %>

                      </table>
					  </td>
					  </tr>
					  
                    <tr>
                      <td height="25"></td>
                      <td>
					  <A HREF="#" onclick="checkall()">全选</A>&nbsp;&nbsp;<A HREF="#" onclick="uncheck()">反选</A>
					  </td>
                    </tr>

                    <tr>
                      <td height="25"></td>
                      <td><input type="submit" name="submit1" value="提交" class="button"></td>
                    </tr>
					<INPUT TYPE="hidden" NAME="RoleID" value="<%=RoleID%>">
                  </form>
                  </table>
                  <table border="0" width="98%" cellSpacing="0" cellPadding="0">
                    <tr>
                      <td width="100%" height="5"></td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td width="100%" height="5"></td>
  </tr>
</table>
</body>
</html>
<%
Call conn_close()
%>

